/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.brain.bsc.manager;

import com.brain.bsc.dto.BalancedScoreCardDto;
import com.brain.bsc.dto.PrincipalDto;
import com.brain.sgc.manager.*;
import com.brain.core.exception.DAOException;
import com.brain.core.hibernate.dao.DAOGenerico;
import com.brain.core.manager.ComunManager;
import com.brain.core.manager.RecursosManager;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

/**
 *
 * @author Christian
 */
@Service
public class PrincipalManager extends ComunManager<PrincipalDto> implements Serializable {
    @Resource
    private DAOGenerico<PrincipalDto> springHibernateDao;
    private static Logger logger = Logger.getLogger(MofSexoManager.class);
    @Resource
    private RecursosManager recursosManager;
    
    public PrincipalDto inicializar() {
        PrincipalDto PrincipalDto = new PrincipalDto();
        return PrincipalDto;
    }
 
    public List<PrincipalDto> obtenerPrincipal(BalancedScoreCardDto dto) throws DAOException {
        List<Object> listaParametros = new ArrayList<Object>();
        String hqsql = "select e from PrincipalDto as e where ";
        hqsql += " e.balancedScoreCard = " +  dto.getId();
        hqsql += " and e.padre is null ";
        return springHibernateDao.ejecutarQuery(hqsql, listaParametros);
    }
    public List<PrincipalDto> obtenerObjetivoMedianoPlazo(Long padre) throws DAOException {
        List<Object> listaParametros = new ArrayList<Object>();
        String hqsql = "select e from PrincipalDto as e where ";
        hqsql += " e.padre = " + padre;
        return springHibernateDao.ejecutarQuery(hqsql, listaParametros);
    }
    
}
